from django.shortcuts import render
from . import models
from rest_framework.generics import ListAPIView
from .serializers import BannerModelSerializer, NavModelSerializer
from lufffyapi.settings import constants


# Create your views here.


class BannerListAPIView(ListAPIView):
    queryset = models.Banner.objects.filter(is_show=True, is_deleted=False).order_by('-orders', '-id')[
               :constants.BANNER_LENGTH]
    serializer_class = BannerModelSerializer


class NavListAPIView(ListAPIView):
    queryset = models.Nav.objects.filter(is_show=True, is_deleted=False, position=1).order_by('-orders', '-id')[
               :constants.HEADER_NAV_LENGTH]
    serializer_class = NavModelSerializer
